package com.woorigil.social.parser;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.woorigil.social.domain.ProviderCode;

@Component
public class CategoryMapperFactory {
	@Autowired Map<String, CategoryMapper> instances = new HashMap<String, CategoryMapper>();

	public CategoryMapper getInstance(ProviderCode providerCode) {
		CategoryMapper instance = instances.get(providerCode.name() + "Mapper");
		if (instance == null) {
			throw new IllegalArgumentException("CategoryMapper instance is not found.");
		}
		return instance;
	}
}
